Calculating DXL Attribute

Hello,

I have an issue regarding one of my DXL attributes, and I was hoping you guys could provide me with some insight.

I have a DXL attribute that will get ALL the links for an object, and then copy these values to a TEXT attribute. So, the thing is that if I insert this new attribute to an old module (by old, i mean that there are already links defined), and execute it, the TEXT attribute does not update until I click the object. Once I click the object the calculated links will be copied over.

I'm working with a document that has 1,000 or so reqs, so I don't want to go through each individual one and click them to get the value to show. Is there a way I can update all the objects? I've tried the "refresh DXL attribute" in the tools menu, and also looping through each object and setting the DXL attribute to null in order to force a re-calculate.

Thanks!
wcheng - Wed Nov 25 19:58:49 EST 2009

Re: Calculating DXL Attribute
Mathias Mamsch - Thu Nov 26 03:19:43 EST 2009

It seems you have an error in your code there? May you have a "current Object" statement somewhere in the trigger instead of using the "obj" variable :-)

Re: Calculating DXL Attribute
Mathias Mamsch - Thu Nov 26 03:20:17 EST 2009

Mathias Mamsch - Thu Nov 26 03:19:43 EST 2009
It seems you have an error in your code there? May you have a "current Object" statement somewhere in the trigger instead of using the "obj" variable :-)

I meant "DXL attribute" instead of trigger. Sorry for that.

Re: Calculating DXL Attribute
ePiallat - Thu Nov 26 03:52:37 EST 2009

Hi,

DXL attributes are refreshed when, trying to get their value, a null value is returned.
To force update, you have to loop through objects and read the new value just after you set it to null.

Re: Calculating DXL Attribute
llandale - Mon Nov 30 15:29:18 EST 2009

There's no reason for the AttrDXL to set another Text attribute. Define the AttrDXL as 'text' and have it set itself via obj.attrDXLName = Results. Other DXL or whatever can use this attr normally.

AttrDXL calculates when its first used after the module is open. If you are displaying that other Text attribute and not the attrDXL attribute, then it won't fire. Odd it fires when you click on the object.

Also, yes may be a 'current Object' reference. Instead, use the pre-defined variable 'obj' to mean 'the object being calculated by my AttrDXL or Layout'. Here's a template:

Link lnk
Buffer buf = create
bool   DoneOne = false
for lnk in obj ->"*" do     // <<Notice 'obj' is not declared nor assigned>>
{  if this link qualifies for display
   {  if (DoneOne) buf += "\n"   // EOL after previous link info
      DoneOne = true
      buf += whatever link info I want about this link
   }
}
if (!DoneOne) buf += " "
obj.attrDXLName = tempStringOf(buf)
delete(buf)


The purpose of displaying a space instead of nothing is because a null value is a flag that causes recalculation of the attrDXL. If the result is null then that object's attrDXL will calculate far too frequently.

 

 

  • Louie